package com.zhongnan.demo7.executors;

import java.util.concurrent.ArrayBlockingQueue;
import java.util.concurrent.Executors;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;

public class MyThreadPool {
    public static void main(String[] args) {
        // 1.核心线程的数量
        // 2.最大线程数量
        // 3.临时线程的存活时间（值）
        // 4.临时线程的存活时间（单位）
        // 5.任务队列
        // 6.创建线程工厂
        // 7.任务的拒绝策略
        ThreadPoolExecutor pool = new ThreadPoolExecutor(
                2,
                4,
                2,
                TimeUnit.SECONDS,
                new ArrayBlockingQueue<>(8),
                Executors.defaultThreadFactory(),
                new ThreadPoolExecutor.AbortPolicy());
        pool.getPoolSize();
        pool.submit(()->{

        });
        pool.shutdown();
    }
}
